/*--------------------------------------------------------------------------------
	DESCRIPTION: Cleaning World Justice Project

--------------------------------------------------------------------------------*/

clear
use "$data_dir/raw/WJP/GPP dataset.dta"

clonevar ccode = country_code

replace ccode = "CYP" if ccode=="CPY"
replace ccode = "HND" if ccode=="HON"

merge m:1 ccode using "$data_dir/raw/countrycodes.dta"
drop if _merge==2
drop _merge

gen survey = "WJP"
summ year
gen wave = year-(r(min)-1)

gen weight = .

**********************************
*************TRUST VALUES*********
**********************************

gen trust_govt = 1 if q1c==1|q1c==2 //officers working in the national government
replace trust_govt = 0 if q1c==3|q1c==4

gen trust_justice = 1 if q1g==1|q1g==2 //N.B. this refers specifically to "judges and magistrates"
replace trust_justice = 0 if q1g==3|q1g==4

gen trust_police = 1 if q1d==1|q1d==2
replace trust_police = 0 if q1d==3|q1d==4

gen trust_civil_service = 1 if q1h==1|q1h==2
replace trust_civil_service = 0 if q1h==3|q1h==4

gen trust_local_govt = 1 if q1b==1|q1b==2
replace trust_local_govt = 0 if q1b==3|q1b==4

gen trust_parties = 1 if q1j==1|q1j==2
replace trust_parties = 0 if q1j==3|q1j==4

gen trust_parliament = .

gen trust_others = 1 if q1a==1|q1a==2 //how much trust do you have for people living in this country
replace trust_others = 0 if q1a==3|q1a==4

gen trust_military = .

pca trust_govt trust_justice trust_police trust_local_govt, comp(1)
predict mtrust_state
summ mtrust_state, de
gen trust_state = 1 if mtrust_state>=r(p50) & mtrust_state!=.
replace trust_state = 0 if mtrust_state<r(p50) & mtrust_state!=.

************************************************
*************INDIVIDUAL CHARACTERISTICS*********
************************************************

gen survey_year = year

tostring age, gen(age_string)
gen number_of_integers = strlen(age_string)
replace age = . if number_of_integers==1 //some countries only gave single digits as age so make as missing
drop age_string number_of_integers

gen yob = survey_year-age

gen cohort = ""
forvalues i = 1870(10)2010 {
	replace cohort = "`i's" if yob>=`i' & yob<(`i'+10)
}

*sex
*			-99
*			1 male
*			2 female

gen sex = 1 if gend==1
replace sex = 2 if gend==2
replace sex = -99 if gend==.

*religion
*			1   Do not belong to a denomination
*			2   Buddhist                
*			3   Jewish                  
*			4   Christian               
*			5   Muslim                  
*			6   Other 
*			7   Hindu 
*		  -99   Missing 

gen religion = -99

*edu
*			1   Primary
*			2   Secondary
*			3   Tertiary
*			4   Other
*		  -99   Missing

rename edu edu_wjp
gen edu = 1 if edu_wjp==1
replace edu = 2 if edu_wjp==2|edu_wjp==3|edu_wjp==4
replace edu = 3 if edu_wjp==5|edu_wjp==6
replace edu = 4 if edu_wjp==1
replace edu = -99 if edu_wjp==99|edu_wjp==7|edu_wjp==8

*occupation
*			1   Managers
*			2   Professionals
*			3   Technicians and Associate Professionals
*			4   Clerical Support Workers
*			5   Service and Sales Workers
*			6   Skilled Agricultural, Forestry and Fishery Workers
*			7   Craft and Related Trades Workers
*			8   Plant and Machine Operators, and Assemblers
*			9   Elementary Occupations
*			0   Armed Forces Occupations
*	      -99   Missing

gen occupation = -99

*employment_status
*			1   Employed
*			2   Unemployed
*			3   Other
*		  -99   Missing

gen employment_status = -99

*income
*			1   Band 1
*			2   Band 2
*			3   Band 3
*			4   Band 4
*			5   Band 5
*			6   Band 6
*			7   Band 7
*			8   Band 8
*			9   Band 9
*		   10   Band 10
*		  -99   Missing

rename income sincome_wjp
replace sincome_wjp = strtrim(sincome_wjp)
replace sincome_wjp = ustrtrim(sincome_wjp)

gen income_wjp = usubinstr(sincome_wjp, "`=uchar(65533)'", ":", .)

gen income = . 

replace income = 1 if income_wjp=="6,000 Afghanis or less" & ccode=="AFG" & income==.
replace income = 3 if income_wjp=="From 6,001 to 8,000" & ccode=="AFG" & income==.
replace income = 5 if income_wjp=="From 8,001 to 9,000" & ccode=="AFG" & income==.
replace income = 7 if income_wjp=="From 9,001 to 10,000" & ccode=="AFG" & income==.
replace income = 9 if income_wjp=="More than 10,001 Afghanis" & ccode=="AFG" & income==.
replace income = -99 if income_wjp=="Refused (vol.)/Don't Know (vol.)" & ccode=="AFG" & income==.

replace income = 1 if income_wjp=="AOA 0 - AOA70,000" & ccode=="AGO" & income==.
replace income = 3 if income_wjp=="AOA71,000 - AOA140,000" & ccode=="AGO" & income==.
replace income = 5 if income_wjp=="AOA141,000 - AOA210,000" & ccode=="AGO" & income==.
replace income = 7 if income_wjp=="AOA 211,000 - AOA 280,000" & ccode=="AGO" & income==.
replace income = 9 if income_wjp=="AOA 281,000 - e acima" & ccode=="AGO" & income==.
replace income = -99 if income_wjp=="" & ccode=="AGO" & income==.

replace income = 1 if income_wjp=="0-15,000" & ccode=="ALB" & income==.
replace income = 3 if income_wjp=="15,001-25,000" & ccode=="ALB" & income==.
replace income = 5 if income_wjp=="25,001-35,000" & ccode=="ALB" & income==.
replace income = 7 if income_wjp=="35,001-50,000" & ccode=="ALB" & income==.
replace income = 9 if income_wjp=="over 50,000" & ccode=="ALB" & income==.
replace income = -99 if income_wjp=="" & ccode=="ALB" & income==.

replace income = 1 if income_wjp=="0 to 43000 pesos" & ccode=="ARG" & income==.
replace income = 3 if income_wjp=="43.000 to 65.000 pesos" & ccode=="ARG" & income==.
replace income = 5 if income_wjp=="65.000 to 94.000 pesos" & ccode=="ARG" & income==.
replace income = 7 if income_wjp=="94.000 to 140.000 pesos" & ccode=="ARG" & income==.
replace income = 9 if income_wjp=="More 140.000 pesos" & ccode=="ARG" & income==.
replace income = -99 if income_wjp=="" & ccode=="ARG" & income==.

replace income = 1 if income_wjp=="Less than $650" & ccode=="AUS" & income==.
replace income = 3 if income_wjp=="$650 - $1,249" & ccode=="AUS" & income==.
replace income = 5 if income_wjp=="$1,250 - $1,999" & ccode=="AUS" & income==.
replace income = 7 if income_wjp=="$2,000 - $2,999" & ccode=="AUS" & income==.
replace income = 9 if income_wjp=="$3,000 and above" & ccode=="AUS" & income==.
replace income = -99 if income_wjp=="" & ccode=="AUS" & income==.

replace income = 1 if (income_wjp=="Less than EUR 25.000" | income_wjp=="EUR 25.000 - 29.999" | income_wjp=="EUR 30.000 - 34.999") & ccode=="AUT" & income==.
replace income = 3 if (income_wjp=="EUR 35.000 - 39.999" | income_wjp=="EUR 40.000 - 44.999" | income_wjp=="EUR 45.000 - 49.999") & ccode=="AUT" & income==.
replace income = 5 if (income_wjp=="EUR 50.000 - 59.999" | income_wjp=="EUR 60.000 - 69.999" | income_wjp=="EUR 70.000 - 79.999") & ccode=="AUT" & income==.
replace income = 7 if (income_wjp=="EUR 80.000 - 89.999" | income_wjp=="EUR 90.000 - 99.999" | income_wjp=="EUR 100.000 - 124.999") & ccode=="AUT" & income==.
replace income = 9 if (income_wjp=="EUR 125.000 - 149.999" | income_wjp=="EUR 150.000 or more") & ccode=="AUT" & income==.
replace income = -99 if income_wjp=="" & ccode=="AUT" & income==.

replace income = 1 if (income_wjp=="Less than €6,000" | income_wjp=="€6,000 - €11,999" | income_wjp=="€12,000 - €17,999") & ccode=="BEL" & income==.
replace income = 3 if (income_wjp=="€18,000 - €23,999" | income_wjp=="€24,000 - €29,999" | income_wjp=="€30,000 - €35,999") & ccode=="BEL" & income==.
replace income = 5 if (income_wjp=="€36,000 - €41,999" | income_wjp=="€42,000 - €47,999" | income_wjp=="€48,000 - €53,999") & ccode=="BEL" & income==.
replace income = 7 if (income_wjp=="€54,000 - €59,999" | income_wjp=="€60,000 - €69,999" | income_wjp=="€70,000 - €89,999") & ccode=="BEL" & income==.
replace income = 9 if (income_wjp=="€90,000 - €109,999" | income_wjp=="€110,000 or more") & ccode=="BEL" & income==.
replace income = -99 if income_wjp=="" & ccode=="BEL" & income==.

replace income = 1 if income_wjp=="Less than 200 000 FCFA" & ccode=="BEN" & income==.
replace income = 3 if income_wjp=="200 000 to 400 000 FCFA" & ccode=="BEN" & income==.
replace income = 5 if income_wjp=="400 000 to 600 000 FCFA" & ccode=="BEN" & income==.
replace income = 7 if income_wjp=="600 000 to 800 000 FCFA" & ccode=="BEN" & income==.
replace income = 9 if income_wjp=="More than 800 000 FCFA" & ccode=="BEN" & income==.
replace income = -99 if income_wjp=="Don't Know/No answer" & ccode=="BEN" & income==.

replace income = 1 if (income_wjp=="Moins de 30,000 F CFA" | income_wjp=="30,001 - 100,000 F CFA") & ccode=="BFA" & income==.
replace income = 3 if income_wjp=="100,001 - 199, 999 F CFA" & ccode=="BFA" & income==.
replace income = 5 if income_wjp=="200,000 - 300,000 F CFA" & ccode=="BFA" & income==.
replace income = 7 if (income_wjp=="300,001 - 400,000 F CFA" | income_wjp=="400 001 - 600,000 F CFA") & ccode=="BFA" & income==.
replace income = 9 if (income_wjp=="600,001 - 800,000 F CFA" | income_wjp=="Plus de 800,000 F CFA") & ccode=="BFA" & income==.
replace income = -99 if income_wjp=="Don:t know/No answer" & ccode=="BFA" & income==.

replace income = 1 if (income_wjp=="10,000 Takas or less" | income_wjp=="10,001-15,000 Takas") & ccode=="BGD" & income==.
replace income = 3 if income_wjp=="15,001-20,000 Takas" & ccode=="BGD" & income==.
replace income = 5 if income_wjp=="20,001-30,000 Takas" & ccode=="BGD" & income==.
replace income = 7 if income_wjp=="30,001 -40,000 Takas" & ccode=="BGD" & income==.
replace income = 9 if income_wjp=="More than 40,000 Takas" & ccode=="BGD" & income==.
replace income = -99 if income_wjp=="" & ccode=="BGD" & income==.

replace income = 1 if income_wjp=="1st quintile range" & ccode=="BGR" & income==.
replace income = 3 if income_wjp=="2nd quintile range" & ccode=="BGR" & income==.
replace income = 5 if income_wjp=="3rd quintile range" & ccode=="BGR" & income==.
replace income = 7 if income_wjp=="4th quintile range" & ccode=="BGR" & income==.
replace income = 9 if income_wjp=="5th quintile range" & ccode=="BGR" & income==.
replace income = -99 if income_wjp=="Don’t know/No answer" & income==.

replace income = 1 if income_wjp=="Less than 1500 BSD" & ccode=="BHS" & income==.
replace income = 3 if income_wjp=="1500 to 2999 BSD" & ccode=="BHS" & income==.
replace income = 5 if income_wjp=="3000 to 3499 BSD" & ccode=="BHS" & income==.
replace income = 7 if income_wjp=="3500 to 4499 BSD" & ccode=="BHS" & income==.
replace income = 9 if income_wjp=="4500 BSD and More" & ccode=="BHS" & income==.
replace income = -99 if income_wjp=="" & ccode=="BHS" & income==.

replace income = 1 if income_wjp=="Less than 500 KM" & ccode=="BIH" & income==.
replace income = 3 if income_wjp=="From 501 to 800" & ccode=="BIH" & income==.
replace income = 5 if income_wjp=="From 801 to 1100" & ccode=="BIH" & income==.
replace income = 7 if income_wjp=="From 1101 to 1400 KM" & ccode=="BIH" & income==.
replace income = 9 if income_wjp=="More than 1401" & ccode=="BIH" & income==.
replace income = -99 if income_wjp=="Don't know/No answer" & income==.

replace income = 1 if income_wjp=="Less than B$z300" & ccode=="BLZ" & income==.
replace income = 3 if income_wjp=="B$z300 to B$z450" & ccode=="BLZ" & income==.
replace income = 5 if income_wjp=="B$z450 to B$z700" & ccode=="BLZ" & income==.
replace income = 7 if income_wjp=="B$z701 to B$z1300" & ccode=="BLZ" & income==.
replace income = 9 if income_wjp=="B$z1301 and more" & ccode=="BLZ" & income==.
replace income = -99 if income_wjp=="" & ccode=="BLZ" & income==.

replace income = 1 if income_wjp=="Hasta 1.812 bs" & ccode=="BOL" & income==.
replace income = 3 if income_wjp=="Desde 1.813 bs hasta 2.995 bs" & ccode=="BOL" & income==.
replace income = 5 if income_wjp=="Desde 2.996 bs hasta 4.485 bs" & ccode=="BOL" & income==.
replace income = 7 if income_wjp=="Desde 4.486 bs hasta 8.073 bs" & ccode=="BOL" & income==.
replace income = 9 if income_wjp=="Más de 8.073 bs" & ccode=="BOL" & income==.
replace income = -99 if income_wjp=="(No leer) No Sabe/No responde" & ccode=="BOL" & income==.

replace income = 1 if income_wjp=="1st quintile range" & ccode=="BRA" & income==.
replace income = 3 if income_wjp=="2nd quintile range" & ccode=="BRA" & income==.
replace income = 5 if income_wjp=="3rd quintile range" & ccode=="BRA" & income==.
replace income = 7 if income_wjp=="4th quintile range" & ccode=="BRA" & income==.
replace income = 9 if income_wjp=="5th quintile range" & ccode=="BRA" & income==.
replace income = -99 if income_wjp=="(DON:T READ) Don:t know/No answer" & ccode=="BRA" & income==.

replace income = 1 if income_wjp=="0-6,000" & ccode=="BWA" & income==.
replace income = 3 if income_wjp=="6,001-9,000" & ccode=="BWA" & income==.
replace income = 5 if income_wjp=="9,001-12,000" & ccode=="BWA" & income==.
replace income = 7 if income_wjp=="12,001-20,000" & ccode=="BWA" & income==.
replace income = 9 if income_wjp=="More than 20,000" & ccode=="BWA" & income==.
replace income = -99 if income_wjp=="Don't know/no answer" & ccode=="BWA" & income==.

replace income = 1 if (income_wjp=="Less than CAD 10.000" | income_wjp=="CAD 10.000 - 19.999" | income_wjp=="CAD 20.000 - 29.999" | income_wjp=="CAD 30.000 - 39.999") & ccode=="CAN" & income==.
replace income = 3 if (income_wjp=="CAD 40.000 - 49.999" | income_wjp=="CAD 50.000 - 59.999" | income_wjp=="CAD 60.000 - 69.999" | income_wjp=="CAD 70.000 - 79.999") & ccode=="CAN" & income==.
replace income = 5 if (income_wjp=="CAD 80.000 - 89.999" | income_wjp=="CAD 90.000 - 99.999" | income_wjp=="CAD 100.000 - 119.999" | income_wjp=="CAD 120.000 - 139.999") & ccode=="CAN" & income==.
replace income = 7 if (income_wjp=="CAD 140.000 - 159.999" | income_wjp=="CAD 160.000 - 179.999" | income_wjp=="CAD 180.000 - 199.999" | income_wjp=="CAD 200.000 - 224.999") & ccode=="CAN" & income==.
replace income = 9 if (income_wjp=="CAD 225.000 - 249.999" | income_wjp=="CAD 250.000 or more") & ccode=="CAN" & income==.
replace income = -99 if income_wjp=="" & ccode=="CAN" & income==.

replace income = 1 if income_wjp=="De 0 a $500.000" & ccode=="CHL" & income==.
replace income = 3 if income_wjp=="De $500.001 a $1.000.000" & ccode=="CHL" & income==.
replace income = 5 if income_wjp=="De $1.000.001 a $1.500.000" & ccode=="CHL" & income==.
replace income = 7 if income_wjp=="De $1.500.001 a 2.000.000" & ccode=="CHL" & income==.
replace income = 9 if income_wjp=="De $2.000.001 y m:s" & ccode=="CHL" & income==.
replace income = -99 if income_wjp=="Dont know/No answer" & ccode=="CHL" & income==.

replace income = 1 if income_wjp=="RMB 4,000 or less" & ccode=="CHN" & income==.
replace income = 3 if income_wjp=="RMB 4,000 - 6,000" & ccode=="CHN" & income==.
replace income = 5 if income_wjp=="RMB 6,000 - 10,000" & ccode=="CHN" & income==.
replace income = 7 if income_wjp=="RMB 10,000 - 20,000" & ccode=="CHN" & income==.
replace income = 9 if income_wjp=="RMB 20,000 or more" & ccode=="CHN" & income==.
replace income = -99 if income_wjp=="Don't know/no answer" & ccode=="CHN" & income==.

replace income = 1 if income_wjp=="J. Moins de 200 000 FCFA" & ccode=="CIV" & income==.
replace income = 3 if income_wjp=="R. 200 000 : 400 000 FCFA" & ccode=="CIV" & income==.
replace income = 5 if income_wjp=="C. 400 000 : 600 000 FCFA" & ccode=="CIV" & income==.
replace income = 7 if income_wjp=="M. 600 000 : 800 000 FCFA" & ccode=="CIV" & income==.
replace income = 9 if income_wjp=="F. Plus de 800 000 FCFA" & ccode=="CIV" & income==.
replace income = -99 if income_wjp=="(NE PAS LIRE) Ne sais pas/pas de r:ponse" & ccode=="CIV" & income==.

replace income = 1 if income_wjp=="Less than 200 000 FCFA" & ccode=="CMR" & income==.
replace income = 3 if income_wjp=="200 000 to 400 000 FCFA" & ccode=="CMR" & income==.
replace income = 5 if income_wjp=="400 000 to 600 000 FCFA" & ccode=="CMR" & income==.
replace income = 7 if income_wjp=="600 000 to 800 000 FCFA" & ccode=="CMR" & income==.
replace income = 9 if income_wjp=="More than 800 000 FCFA" & ccode=="CMR" & income==.
replace income = -99 if income_wjp=="Don't Know/No answer" & ccode=="CMR" & income==.

replace income = 1 if income_wjp=="Up to 60.2" & ccode=="COD" & income==.
replace income = 3 if income_wjp=="60.2-200.8" & ccode=="COD" & income==.
replace income = 5 if income_wjp=="200.9-2,602.5" & ccode=="COD" & income==.
replace income = 7 if income_wjp=="602.6-1,606.7" & ccode=="COD" & income==.
replace income = 9 if income_wjp=="More than 1,606.7" & ccode=="COD" & income==.
replace income = -99 if income_wjp=="Don't know/no answer" & ccode=="COD" & income==.

replace income = 1 if income_wjp=="Less than 200,000 FCFA" & ccode=="COG" & income==.
replace income = 3 if income_wjp=="200,000 to 400,000 FCFA" & ccode=="COG" & income==.
replace income = 5 if income_wjp=="400,000 to 600,000 FCFA" & ccode=="COG" & income==.
replace income = 7 if income_wjp=="600,000 to 800,000 FCFA" & ccode=="COG" & income==.
replace income = 9 if income_wjp=="More than 800,000 FCFA" & ccode=="COG" & income==.
replace income = -99 if income_wjp=="(DON’T READ) Don’t know/No answer" & ccode=="COG" & income==.

replace income = 1 if income_wjp=="1st quintile range" & ccode=="COL" & income==.
replace income = 3 if income_wjp=="2nd quintile range" & ccode=="COL" & income==.
replace income = 5 if income_wjp=="3rd quintile range" & ccode=="COL" & income==.
replace income = 7 if income_wjp=="4th quintile range" & ccode=="COL" & income==.
replace income = 9 if income_wjp=="5th quintile range" & ccode=="COL" & income==.
replace income = -99 if income_wjp=="Don:t know/No answer" & ccode=="COL" & income==.

replace income = 1 if income_wjp=="Menos de ₡94640" & ccode=="CRI" & income==.
replace income = 3 if income_wjp=="₡94641 a ₡165000" & ccode=="CRI" & income==.
replace income = 5 if income_wjp=="₡165001 a ₡280734" & ccode=="CRI" & income==.
replace income = 7 if income_wjp=="₡280735 a ₡520000" & ccode=="CRI" & income==.
replace income = 9 if income_wjp=="₡520001 o más" & ccode=="CRI" & income==.
replace income = -99 if income_wjp=="" & ccode=="CRI" & income==.

replace income = 1 if income_wjp=="Up to €15,140" & ccode=="CYP" & income==.
replace income = 3 if income_wjp=="€15,141-€23,015" & ccode=="CYP" & income==.
replace income = 5 if income_wjp=="€23,016-€33,047" & ccode=="CYP" & income==.
replace income = 7 if income_wjp=="€33,048-€47,704" & ccode=="CYP" & income==.
replace income = 9 if income_wjp=="€47,705+" & ccode=="CYP" & income==.
replace income = -99 if income_wjp=="Don't Know/Don't answer" & ccode=="CYP" & income==.

replace income = 1 if (income_wjp=="Less than CZK 100.000" | income_wjp=="CZK 100.000 - 149.999" | income_wjp=="CZK 150.000 - 199.999") & ccode=="CZE" & income==.
replace income = 3 if (income_wjp=="CZK 200.000 - 249.999" | income_wjp=="CZK 250.000 - 299.999" | income_wjp=="CZK 300.000 - 349.999") & ccode=="CZE" & income==.
replace income = 5 if (income_wjp=="CZK 350.000 - 399.999" | income_wjp=="CZK 400.000 - 449.999" | income_wjp=="CZK 450.000 - 499.999") & ccode=="CZE" & income==.
replace income = 7 if (income_wjp=="CZK 500.000 - 599.999" | income_wjp=="CZK 600.000 - 699.999" | income_wjp=="CZK 700.000 - 799.999") & ccode=="CZE" & income==.
replace income = 9 if (income_wjp=="CZK 800.000 - 899.999" | income_wjp=="CZK 900.000 - 999.999" | income_wjp=="CZK 1.000.000 or more") & ccode=="CZE" & income==.
replace income = -99 if income_wjp=="" & ccode=="CZE" & income==.

replace income = 1 if (income_wjp=="Less than €6,000" | income_wjp=="€6,000 - €11,999" | income_wjp=="€12,000 - €17,999") & ccode=="DEU" & income==.
replace income = 3 if (income_wjp=="€18,000 - €23,999" | income_wjp=="€24,000 - €29,999" | income_wjp=="€30,000 - €35,999") & ccode=="DEU" & income==.
replace income = 5 if (income_wjp=="€36,000 - €41,999" | income_wjp=="€42,000 - €47,999" | income_wjp=="€48,000 - €53,999") & ccode=="DEU" & income==.
replace income = 7 if (income_wjp=="€54,000 - €59,999" | income_wjp=="€70,000 - €89,999") & ccode=="DEU" & income==.
replace income = 9 if (income_wjp=="€90,000 - €109,999" | income_wjp=="€110,000 or more") & ccode=="DEU" & income==.
replace income = -99 if income_wjp=="" & ccode=="DEU" & income==.

replace income = 1 if income_wjp=="Less than 1500 XCD" & ccode=="DMA" & income==.
replace income = 3 if income_wjp=="1500 to 3000 XCD" & ccode=="DMA" & income==.
replace income = 5 if income_wjp=="3001 to 4500 XCD" & ccode=="DMA" & income==.
replace income = 7 if income_wjp=="4501 to 6000 XCD" & ccode=="DMA" & income==.
replace income = 9 if income_wjp=="More than 6000 XCD" & ccode=="DMA" & income==.
replace income = -99 if income_wjp=="(DON’T READ) Don’t know/No answer" & ccode=="DMA" & income==.

replace income = 1 if (income_wjp=="Less than 200.000 DKK" | income_wjp=="200.000 - 299.999 DKK") & ccode=="DNK" & income==.
replace income = 3 if (income_wjp=="300.000 - 399.999 DKK" | income_wjp=="400.000 - 499.999 DKK") & ccode=="DNK" & income==.
replace income = 5 if (income_wjp=="500.000 - 599.999 DKK" | income_wjp=="600.000 - 699.999 DKK") & ccode=="DNK" & income==.
replace income = 7 if (income_wjp=="700.000 - 799.999 DKK" | income_wjp=="800.000 - 899.999 DKK") & ccode=="DNK" & income==.
replace income = 9 if (income_wjp=="900.000 - 999.999 DKK" | income_wjp=="1.000.000 DKK or more") & ccode=="DNK" & income==.
replace income = -99 if income_wjp=="" & ccode=="DNK" & income==.

replace income = 1 if income_wjp=="Less than 16.409,00" & ccode=="DOM" & income==.
replace income = 3 if income_wjp=="Entre 16.410,00 y 35.574,00" & ccode=="DOM" & income==.
replace income = 5 if income_wjp=="Entre 35.575,00 y 45.414,00" & ccode=="DOM" & income==.
replace income = 7 if income_wjp=="Entre 45.415,00 y 64.565,00" & ccode=="DOM" & income==.
replace income = 9 if income_wjp=="64.566,00 and more" & ccode=="DOM" & income==.
replace income = -99 if income_wjp=="" & ccode=="DOM" & income==.

replace income = 1 if income_wjp=="Less then 35000 Ad" & ccode=="DZA" & income==.
replace income = 3 if income_wjp=="35001 - 42500 AD" & ccode=="DZA" & income==.
replace income = 5 if income_wjp=="42501 - 50000 AD" & ccode=="DZA" & income==.
replace income = 7 if income_wjp=="50001 - 70000 AD" & ccode=="DZA" & income==.
replace income = 9 if income_wjp=="More than 70000 AD" & ccode=="DZA" & income==.
replace income = -99 if income_wjp=="" & ccode=="DZA" & income==.

replace income = 1 if income_wjp=="Menos de 180  USD" & ccode=="ECU" & income==.
replace income = 3 if income_wjp=="Entre 181 y 840 USD" & ccode=="ECU" & income==.
replace income = 5 if income_wjp=="Entre 840 y 1800 USD" & ccode=="ECU" & income==.
replace income = 7 if income_wjp=="Entre 1800 y 2880 USD" & ccode=="ECU" & income==.
replace income = 9 if income_wjp=="Mas de 2881" & ccode=="ECU" & income==.
replace income = -99 if income_wjp=="" & ccode=="ECU" & income==.

replace income = 1 if (income_wjp=="Less than €6,000" | income_wjp=="€6,000 - €11,999" | income_wjp=="€12,000 - €17,999") & ccode=="ESP" & income==.
replace income = 3 if (income_wjp=="€18,000 - €23,999" | income_wjp=="€24,000 - €29,999" | income_wjp=="€30,000 - €35,999") & ccode=="ESP" & income==.
replace income = 5 if (income_wjp=="€36,000 - €41,999" | income_wjp=="€42,000 - €47,999" | income_wjp=="€48,000 - €53,999") & ccode=="ESP" & income==.
replace income = 7 if (income_wjp=="€54,000 - €59,999" | income_wjp=="€60,000 - €69,999" | income_wjp=="€70,000 - €89,999") & ccode=="ESP" & income==.
replace income = 9 if (income_wjp=="€90,000 - €109,999" | income_wjp=="€110,000 or more") & ccode=="ESP" & income==.
replace income = -99 if income_wjp=="" & ccode=="ESP" & income==.

replace income = 1 if (income_wjp=="Up to 1200 EUR" | income_wjp=="1200,01-2400 EUR" | income_wjp=="2400,01-3600 EUR") & ccode=="EST" & income==.
replace income = 3 if (income_wjp=="3600,01-4800 EUR" | income_wjp=="4800,01-6000 EUR" | income_wjp=="6000,01-7200 EUR") & ccode=="EST" & income==.
replace income = 5 if (income_wjp=="7200,01-8400 EUR" | income_wjp=="8400,01-9600 EUR" | income_wjp=="9600,01-10 800 EUR") & ccode=="EST" & income==.
replace income = 7 if (income_wjp=="10 800,01- 12 000 EUR" | income_wjp=="12 000,01 - 14 400 EUR" | income_wjp=="14 400,01 - 16 800 EUR") & ccode=="EST" & income==.
replace income = 9 if (income_wjp=="16 800,01 -  19 200 EUR" | income_wjp=="19 200,01 EUR or more") & ccode=="EST" & income==.
replace income = -99 if income_wjp=="" & ccode=="EST" & income==.

replace income = 1 if income_wjp=="Less than 2500" & ccode=="ETH" & income==.
replace income = 3 if income_wjp=="2501-4000" & ccode=="ETH" & income==.
replace income = 5 if income_wjp=="4001-6000" & ccode=="ETH" & income==.
replace income = 7 if income_wjp=="6001-8000" & ccode=="ETH" & income==.
replace income = 9 if income_wjp=="More than 8000" & ccode=="ETH" & income==.
replace income = -99 if income_wjp=="." & ccode=="ETH" & income==.

replace income = 1 if (income_wjp=="Less than EUR 14.999" | income_wjp=="EUR 15.000 : 19.999") & ccode=="FIN" & income==.
replace income = 3 if income_wjp=="EUR 20.000 : 39.999" & ccode=="FIN" & income==.
replace income = 5 if income_wjp=="EUR 40.000 : 69.999" & ccode=="FIN" & income==.
replace income = 7 if income_wjp=="EUR 70.000 : 99.999" & ccode=="FIN" & income==.
replace income = 9 if (income_wjp=="EUR 100.000 : 119.999" | income_wjp=="EUR 120.000 : 149.999" | income_wjp=="EUR 150.000 or more") & ccode=="FIN" & income==.
replace income = -99 if income_wjp=="" & ccode=="FIN" & income==.

replace income = 1 if (income_wjp=="Less than €6,000" | income_wjp=="€12,000 - €17,999" | income_wjp=="€18,000 - €23,999") & ccode=="FRA" & income==.
replace income = 3 if (income_wjp=="€24,000 - €29,999" | income_wjp=="€30,000 - €35,999" | income_wjp=="€36,000 - €41,999") & ccode=="FRA" & income==.
replace income = 5 if (income_wjp=="€42,000 - €47,999" | income_wjp=="€48,000 - €53,999" | income_wjp=="€54,000 - €59,999") & ccode=="FRA" & income==.
replace income = 7 if (income_wjp=="€60,000 - €69,999" | income_wjp=="€70,000 - €89,999") & ccode=="FRA" & income==.
replace income = 9 if (income_wjp=="€90,000 - €109,999" | income_wjp=="€110,000 or more") & ccode=="FRA" & income==.
replace income = -99 if income_wjp=="" & ccode=="FRA" & income==.

replace income = 1 if income_wjp=="< 50,000" & ccode=="GAB" & income==.
replace income = 3 if income_wjp=="50,001 - 150000" & ccode=="GAB" & income==.
replace income = 5 if income_wjp=="150001 - 300000" & ccode=="GAB" & income==.
replace income = 7 if income_wjp=="300001 - 500000" & ccode=="GAB" & income==.
replace income = 9 if income_wjp=="500,001 and above" & ccode=="GAB" & income==.
replace income = -99 if income_wjp=="(DON’T READ) Don’t know/No answer" & ccode=="GAB" & income==.

replace income = 1 if income_wjp=="Less than £15.000" & ccode=="GBR" & income==.
replace income = 3 if income_wjp=="£15.000 - £24.999" & ccode=="GBR" & income==.
replace income = 5 if income_wjp=="£25.000 - £39.999" & ccode=="GBR" & income==.
replace income = 7 if income_wjp=="£40.000 - £59.999" & ccode=="GBR" & income==.
replace income = 9 if income_wjp=="£60.000 or more" & ccode=="GBR" & income==.
replace income = -99 if income_wjp=="" & ccode=="GBR" & income==.

replace income = 1 if income_wjp=="0-200" & ccode=="GEO" & income==.
replace income = 3 if income_wjp=="201-400" & ccode=="GEO" & income==.
replace income = 5 if income_wjp=="401-600" & ccode=="GEO" & income==.
replace income = 7 if income_wjp=="601-1000" & ccode=="GEO" & income==.
replace income = 9 if income_wjp=="1001 and more" & ccode=="GEO" & income==.
replace income = -99 if income_wjp=="(DON:T READ) Don:t know/No answer" & ccode=="GEO" & income==.

replace income = 1 if income_wjp=="200 or less" & ccode=="GHA" & income==.
replace income = 3 if income_wjp=="201-350" & ccode=="GHA" & income==.
replace income = 5 if income_wjp=="351-500" & ccode=="GHA" & income==.
replace income = 7 if income_wjp=="501-800" & ccode=="GHA" & income==.
replace income = 9 if income_wjp=="More than 800" & ccode=="GHA" & income==.
replace income = -99 if income_wjp=="" & ccode=="GHA" & income==.

replace income = 1 if income_wjp=="Less than 895.727 GNF" & ccode=="GIN" & income==.
replace income = 3 if income_wjp=="895.727 GNF - 1330239 GNF" & ccode=="GIN" & income==.
replace income = 5 if income_wjp=="1330240 GNF - 1688696 GNF" & ccode=="GIN" & income==.
replace income = 7 if income_wjp=="1688697 GNF - 2080666 GNF" & ccode=="GIN" & income==.
replace income = 9 if income_wjp=="2080667 GNF or more" & ccode=="GIN" & income==.
replace income = -99 if income_wjp=="Don't know/no answer" & ccode=="GIN" & income==.

replace income = 1 if income_wjp=="1st quintile range" & ccode=="GMB" & income==.
replace income = 3 if income_wjp=="2nd quintile range" & ccode=="GMB" & income==.
replace income = 5 if income_wjp=="3rd quintile range" & ccode=="GMB" & income==.
replace income = 7 if income_wjp=="4th quintile range" & ccode=="GMB" & income==.
replace income = 9 if income_wjp=="5th quintile range" & ccode=="GMB" & income==.
replace income = -99 if income_wjp=="" & ccode=="GMB" & income==.

replace income = 1 if (income_wjp=="Less than EUR 2.500" | income_wjp=="EUR 2.500 - 4.999" | income_wjp=="EUR 5.000 - 9.999" | income_wjp=="EUR 10.000 - 14.999") & ccode=="GRC" & income==.
replace income = 3 if (income_wjp=="EUR 15.000 - 19.999" | income_wjp=="EUR 20.000 - 24.999" | income_wjp=="EUR 25.000 - 29.999") & ccode=="GRC" & income==.
replace income = 5 if (income_wjp=="EUR 30.000 - 34.999" | income_wjp=="EUR 35.000 - 39.999" | income_wjp=="EUR 40.000 - 44.999") & ccode=="GRC" & income==.
replace income = 7 if (income_wjp=="EUR 45.000 - 49.999" | income_wjp=="EUR 50.000 - 59.999" | income_wjp=="EUR 60.000 - 69.999") & ccode=="GRC" & income==.
replace income = 9 if (income_wjp=="EUR 70.000 - 79.999" | income_wjp=="EUR 80.000 - 89.999" | income_wjp=="EUR 100.000 or more") & ccode=="GRC" & income==.
replace income = -99 if income_wjp=="" & ccode=="GRC" & income==.

replace income = 1 if income_wjp=="Less than 1500 XCD" & ccode=="GRD" & income==.
replace income = 3 if income_wjp=="1500 to 3000 XCD" & ccode=="GRD" & income==.
replace income = 5 if income_wjp=="3001 to 4500 XCD" & ccode=="GRD" & income==.
replace income = 7 if income_wjp=="4501 to 6000 XCD" & ccode=="GRD" & income==.
replace income = 9 if income_wjp=="More than 6000 XCD" & ccode=="GRD" & income==.
replace income = -99 if income_wjp=="(DON’T READ) Don’t know/No answer" & ccode=="GRD" & income==.

replace income = 1 if income_wjp=="Q. 0 a Q 600" & ccode=="GTM" & income==.
replace income = 3 if income_wjp=="Q.601 a Q.1,070" & ccode=="GTM" & income==.
replace income = 5 if income_wjp=="Q.1,071 a Q.1,770" & ccode=="GTM" & income==.
replace income = 7 if income_wjp=="Q.1,771 a Q.3,000" & ccode=="GTM" & income==.
replace income = 9 if income_wjp=="Mas de Q.3,001" & ccode=="GTM" & income==.
replace income = -99 if income_wjp=="(DON:T READ) Don:t know/No answer" & ccode=="GTM" & income==.

replace income = 1 if income_wjp=="< 150.000" & ccode=="GUY" & income==.
replace income = 3 if income_wjp=="150.001 - 300.000" & ccode=="GUY" & income==.
replace income = 5 if income_wjp=="300.001 - 450,000" & ccode=="GUY" & income==.
replace income = 7 if income_wjp=="450.001 - 600.000" & ccode=="GUY" & income==.
replace income = 9 if income_wjp=="More than 600.000" & ccode=="GUY" & income==.
replace income = -99 if income_wjp=="" & ccode=="GUY" & income==.

replace income = 1 if income_wjp=="Less than 10,000" & ccode=="HKG" & income==.
replace income = 3 if income_wjp=="10,000-19,999" & ccode=="HKG" & income==.
replace income = 5 if income_wjp=="20,000-29,999" & ccode=="HKG" & income==.
replace income = 7 if income_wjp=="30,000-49,999" & ccode=="HKG" & income==.
replace income = 9 if income_wjp=="50,000 or more" & ccode=="HKG" & income==.
replace income = -99 if income_wjp=="" & ccode=="HKG" & income==.

replace income = 1 if income_wjp=="L. 0 a L.1,900" & ccode=="HND" & income==.
replace income = 3 if income_wjp=="L. 1,901 a  L. 3,600" & ccode=="HND" & income==.
replace income = 5 if income_wjp=="L. 3,601 a  L. 5,800" & ccode=="HND" & income==.
replace income = 7 if income_wjp=="L. 5,801 a  L. 9,000" & ccode=="HND" & income==.
replace income = 9 if income_wjp=="mas de L.9,001" & ccode=="HND" & income==.
replace income = -99 if income_wjp=="(NO LEER) No Sabe/No responde" & ccode=="HND" & income==.

replace income = 1 if income_wjp=="To 3000 kn" & ccode=="HRV" & income==.
replace income = 3 if income_wjp=="3001-5000 kn" & ccode=="HRV" & income==.
replace income = 5 if income_wjp=="5001-7000 kn" & ccode=="HRV" & income==.
replace income = 7 if income_wjp=="7001-10000 kn" & ccode=="HRV" & income==.
replace income = 9 if income_wjp=="More than 10000 kn" & ccode=="HRV" & income==.
replace income = -99 if income_wjp=="Don:t know/No answer" & ccode=="HRV" & income==.

replace income = 1 if income_wjp=="Mwens pase 208 Goud" & ccode=="HTI" & income==.
replace income = 3 if income_wjp=="210  a 1500" & ccode=="HTI" & income==.
replace income = 5 if income_wjp=="1501 a 4500" & ccode=="HTI" & income==.
replace income = 7 if income_wjp=="4501 a 8500" & ccode=="HTI" & income==.
replace income = 9 if income_wjp=="Plis pase 8500" & ccode=="HTI" & income==.
replace income = -99 if income_wjp=="" & ccode=="HTI" & income==.

replace income = 1 if income_wjp=="60.000 Forint or less" & ccode=="HUN" & income==.
replace income = 3 if income_wjp=="60.001 : 100.000 Forint" & ccode=="HUN" & income==.
replace income = 5 if income_wjp=="100.001 : 200.000 Forint" & ccode=="HUN" & income==.
replace income = 7 if income_wjp=="200.001 : 300.000 Forint" & ccode=="HUN" & income==.
replace income = 9 if income_wjp=="300.000 Forint or more" & ccode=="HUN" & income==.
replace income = -99 if income_wjp=="Don:t know/No answer" & ccode=="HUN" & income==.

replace income = 1 if income_wjp=="Rp 1000.000 - Rp 1.500.000" & ccode=="IDN" & income==.
replace income = 3 if income_wjp=="Rp 1.500.001 - Rp 3.000.000" & ccode=="IDN" & income==.
replace income = 5 if income_wjp=="Rp 3.000.001 - Rp 5000.000" & ccode=="IDN" & income==.
replace income = 7 if income_wjp=="Rp 5.000.001 - Rp 7.500.001" & ccode=="IDN" & income==.
replace income = 9 if income_wjp=="Lebih dari Rp 7.500.000" & ccode=="IDN" & income==.
replace income = -99 if income_wjp=="" & ccode=="IDN" & income==.

replace income = 1 if income_wjp=="MHI upto INR 5000" & ccode=="IND" & income==.
replace income = 3 if income_wjp=="MHI INR 5001- INR 10000" & ccode=="IND" & income==.
replace income = 5 if income_wjp=="MHI INR 10001- INR 20000" & ccode=="IND" & income==.
replace income = 7 if income_wjp=="MHI INR 20001- INR 50000" & ccode=="IND" & income==.
replace income = 9 if income_wjp=="MHI above 50000" & ccode=="IND" & income==.
replace income = -99 if income_wjp=="" & ccode=="IND" & income==.

replace income = 1 if income_wjp=="Less than EUR 17,250" & ccode=="IRL" & income==.
replace income = 3 if income_wjp=="EUR 17,250 to EUR 24,499" & ccode=="IRL" & income==.
replace income = 5 if income_wjp=="EUR 24,500 to EUR 34,999" & ccode=="IRL" & income==.
replace income = 7 if income_wjp=="EUR 35,000 to EUR 51,999" & ccode=="IRL" & income==.
replace income = 9 if income_wjp=="EUR 52,000 or more" & ccode=="IRL" & income==.
replace income = -99 if income_wjp=="Don't know/Prefer not to answer" & ccode=="IRL" & income==.

replace income = 1 if income_wjp=="Less than 1.2 million" & ccode=="IRN" & income==.
replace income = 3 if income_wjp=="1.2 million - 2.5 million" & ccode=="IRN" & income==.
replace income = 5 if income_wjp=="2.5 million - 3.5 million" & ccode=="IRN" & income==.
replace income = 7 if income_wjp=="3.5 million - 4.5 million" & ccode=="IRN" & income==.
replace income = 9 if income_wjp=="4.5 million +" & ccode=="IRN" & income==.
replace income = -99 if income_wjp=="(DON T READ) Don t know/No answer" & ccode=="IRN" & income==.

replace income = 1 if (income_wjp=="Less than EUR 5.000" | income_wjp=="EUR 5.000 - 9.999" | income_wjp=="EUR 10.000 - 14.999" | income_wjp=="EUR 15.000 - 19.999") & ccode=="ITA" & income==.
replace income = 3 if (income_wjp=="EUR 20.000 - 24.999" | income_wjp=="EUR 25.000 - 29.999" | income_wjp=="EUR 30.000 - 34.999") & ccode=="ITA" & income==.
replace income = 5 if (income_wjp=="EUR 35.000 - 39.999" | income_wjp=="EUR 40.000 - 44.999" | income_wjp=="EUR 45.000 - 49.999") & ccode=="ITA" & income==.
replace income = 7 if (income_wjp=="EUR 50.000 - 59.999" | income_wjp=="EUR 60.000 - 69.999" | income_wjp=="EUR 70.000 - 79.999") & ccode=="ITA" & income==.
replace income = 9 if (income_wjp=="EUR 80.000 - 89.999" | income_wjp=="EUR 90.000 - 99.999" | income_wjp=="EUR 100.000 or more") & ccode=="ITA" & income==.
replace income = -99 if income_wjp=="" & ccode=="ITA" & income==.

replace income = 1 if income_wjp=="LESS THAN 600.000,00 JMD" & ccode=="JAM" & income==.
replace income = 3 if income_wjp=="600.000,00 AT 1.439.998,80 JMD" & ccode=="JAM" & income==.
replace income = 5 if income_wjp=="1.439.998,80 AT 2.999.998,80 JMD" & ccode=="JAM" & income==.
replace income = 7 if income_wjp=="3.000.000,00 AT 4.799.998,80 JMD" & ccode=="JAM" & income==.
replace income = 9 if income_wjp=="4.800.000,00 JMD or more" & ccode=="JAM" & income==.
replace income = -99 if income_wjp=="" & ccode=="JAM" & income==.

replace income = 1 if income_wjp=="Less then 500 JD" & ccode=="JOR" & income==.
replace income = 3 if income_wjp=="500 - 1000 JD" & ccode=="JOR" & income==.
replace income = 5 if income_wjp=="1001 - 2000 JD" & ccode=="JOR" & income==.
replace income = 7 if income_wjp=="2001 - 3500 JD" & ccode=="JOR" & income==.
replace income = 9 if income_wjp=="More than 3500 JD" & ccode=="JOR" & income==.
replace income = -99 if income_wjp=="" & ccode=="JOR" & income==.

replace income = 1 if income_wjp=="&lt;2.38 million yen" & ccode=="JPN" & income==.
replace income = 3 if income_wjp=="2.38 - 3.53 million yen" & ccode=="JPN" & income==.
replace income = 5 if income_wjp=="3.54 - 4.95 million yen" & ccode=="JPN" & income==.
replace income = 7 if income_wjp=="4.96 - 7.27 million yen" & ccode=="JPN" & income==.
replace income = 9 if income_wjp=="> 7.27 million yen" & ccode=="JPN" & income==.
replace income = -99 if income_wjp=="" & ccode=="JPN" & income==.

replace income = 1 if income_wjp=="Less than 120000 tenge" & ccode=="KAZ" & income==.
replace income = 3 if income_wjp=="120001 - 170000 tenge" & ccode=="KAZ" & income==.
replace income = 5 if income_wjp=="170001 - 220000 tenge" & ccode=="KAZ" & income==.
replace income = 7 if income_wjp=="220001 - 270000 tenge" & ccode=="KAZ" & income==.
replace income = 9 if income_wjp=="270000 tenge and upper" & ccode=="KAZ" & income==.
replace income = -99 if income_wjp=="" & ccode=="KAZ" & income==.

replace income = 1 if income_wjp=="7,000 or less" & ccode=="KEN" & income==.
replace income = 3 if income_wjp=="7,001-12,000" & ccode=="KEN" & income==.
replace income = 5 if income_wjp=="12,001-20,000" & ccode=="KEN" & income==.
replace income = 7 if income_wjp=="20,001-30,000" & ccode=="KEN" & income==.
replace income = 9 if income_wjp=="More than 30,000" & ccode=="KEN" & income==.
replace income = -99 if income_wjp=="" & ccode=="KEN" & income==.

replace income = 1 if income_wjp=="1st quintile range" & ccode=="KGZ" & income==.
replace income = 3 if income_wjp=="2nd quintile range" & ccode=="KGZ" & income==.
replace income = 5 if income_wjp=="3rd quintile range" & ccode=="KGZ" & income==.
replace income = 7 if income_wjp=="4th quintile range" & ccode=="KGZ" & income==.
replace income = 9 if income_wjp=="5th quintile range" & ccode=="KGZ" & income==.
replace income = -99 if income_wjp=="Don’t know/No answer" & ccode=="KGZ" & income==.

replace income = 1 if (income_wjp=="&lt;10 million KRW" | income_wjp=="10 - 29.99 million KRW") & ccode=="KOR" & income==.
replace income = 3 if income_wjp=="30 - 49.99 million KRW" & ccode=="KOR" & income==.
replace income = 5 if income_wjp=="50 - 69.99 million KRW" & ccode=="KOR" & income==.
replace income = 7 if income_wjp=="70 - 99.99 million KRW" & ccode=="KOR" & income==.
replace income = 9 if income_wjp=="> 100 million KRW" & ccode=="KOR" & income==.
replace income = -99 if income_wjp=="" & ccode=="KOR" & income==.

replace income = 1 if (income_wjp=="Less then 500 $" | income_wjp=="500 - 899 $") & ccode=="LBN" & income==.
replace income = 3 if (income_wjp=="900 - 1299 $" | income_wjp=="1300 - 1999 $") & ccode=="LBN" & income==.
replace income = 5 if (income_wjp=="2000 - 3999 $" | income_wjp=="4000 - 4999 $") & ccode=="LBN" & income==.
replace income = 7 if income_wjp=="5000 - 5999 $" & ccode=="LBN" & income==.
replace income = 9 if income_wjp=="6000 $ ane More" & ccode=="LBN" & income==.
replace income = -99 if income_wjp=="" & ccode=="LBN" & income==.

replace income = 1 if income_wjp=="2,500 or less" & ccode=="LBR" & income==.
replace income = 3 if income_wjp=="2,501-5,800" & ccode=="LBR" & income==.
replace income = 5 if income_wjp=="8,501-8,900" & ccode=="LBR" & income==.
replace income = 7 if income_wjp=="8,901-34,500" & ccode=="LBR" & income==.
replace income = 9 if income_wjp=="More than 34,500" & ccode=="LBR" & income==.
replace income = -99 if income_wjp=="" & ccode=="LBR" & income==.

replace income = 1 if income_wjp=="Less than 1500 XCD" & ccode=="LCA" & income==.
replace income = 3 if income_wjp=="1500 to 3000 XCD" & ccode=="LCA" & income==.
replace income = 5 if income_wjp=="3001 to 4500 XCD" & ccode=="LCA" & income==.
replace income = 7 if income_wjp=="4501 to 6000 XCD" & ccode=="LCA" & income==.
replace income = 9 if income_wjp=="More than 6000 XCD" & ccode=="LCA" & income==.
replace income = -99 if income_wjp=="(DON’T READ) Don’t know/No answer" & ccode=="LCA" & income==.

replace income = 1 if income_wjp=="Up to LKR 16,531" & ccode=="LKA" & income==.
replace income = 3 if income_wjp=="LKR 16,532-LKR 25,903" & ccode=="LKA" & income==.
replace income = 5 if income_wjp=="LKR 25,904-LKR 36,758" & ccode=="LKA" & income==.
replace income = 7 if income_wjp=="LKR 36,759-57,495" & ccode=="LKA" & income==.
replace income = 9 if income_wjp=="More than LKR 57,495" & ccode=="LKA" & income==.
replace income = -99 if (income_wjp=="" | income_wjp=="(DON:T READ) Don:t know/No answer") & ccode=="LKA" & income==.

replace income = 1 if income_wjp=="Less than 4474" & ccode=="LTU" & income==.
replace income = 3 if income_wjp=="4474–6460" & ccode=="LTU" & income==.
replace income = 5 if income_wjp=="6460–8900" & ccode=="LTU" & income==.
replace income = 7 if income_wjp=="8900–12663" & ccode=="LTU" & income==.
replace income = 9 if income_wjp=="12663 or more" & ccode=="LTU" & income==.
replace income = -99 if income_wjp=="" & ccode=="LTU" & income==.

replace income = 1 if income_wjp=="1st quintile range" & ccode=="LUX" & income==.
replace income = 3 if income_wjp=="2nd quintile range" & ccode=="LUX" & income==.
replace income = 5 if income_wjp=="3rd quintile range" & ccode=="LUX" & income==.
replace income = 7 if income_wjp=="4th quintile range" & ccode=="LUX" & income==.
replace income = 9 if income_wjp=="5th quintile range" & ccode=="LUX" & income==.
replace income = -99 if income_wjp=="Don't know/No answer" & ccode=="LUX" & income==.

replace income = 1 if income_wjp=="Less than 4575" & ccode=="LVA" & income==.
replace income = 3 if income_wjp=="4575 – 7028" & ccode=="LVA" & income==.
replace income = 5 if income_wjp=="7028 – 9578" & ccode=="LVA" & income==.
replace income = 7 if income_wjp=="9578 – 13427" & ccode=="LVA" & income==.
replace income = 9 if income_wjp=="13427 or more" & ccode=="LVA" & income==.
replace income = -99 if income_wjp=="" & ccode=="LVA" & income==.

replace income = 1 if income_wjp=="Less then 5000 MAD" & ccode=="MAR" & income==.
replace income = 3 if income_wjp=="5001 - 8000 MAD" & ccode=="MAR" & income==.
replace income = 5 if income_wjp=="8001 - 14000 MAD" & ccode=="MAR" & income==.
replace income = 7 if income_wjp=="14001 - 25000 MAD" & ccode=="MAR" & income==.
replace income = 9 if income_wjp=="25001 MAD and More" & ccode=="MAR" & income==.
replace income = -99 if income_wjp=="" & ccode=="MAR" & income==.

replace income = 1 if income_wjp=="Less than 2000 Lei" & ccode=="MDA" & income==.
replace income = 3 if income_wjp=="2001-4000 Lei" & ccode=="MDA" & income==.
replace income = 5 if income_wjp=="4001-6000 Lei" & ccode=="MDA" & income==.
replace income = 7 if income_wjp=="6001-8000 Lei" & ccode=="MDA" & income==.
replace income = 9 if income_wjp=="More than 8000 Lei" & ccode=="MDA" & income==.
replace income = -99 if income_wjp=="DK/NA" & ccode=="MDA" & income==.

replace income = 1 if income_wjp=="Less than 88,334 MGA or no income" & ccode=="MDG" & income==.
replace income = 3 if income_wjp=="MGA 88,334 - MGA 182,499" & ccode=="MDG" & income==.
replace income = 5 if income_wjp=="MGA 182,500 - MGA 284,285" & ccode=="MDG" & income==.
replace income = 7 if income_wjp=="MGA 284,286 - MGA 470,000" & ccode=="MDG" & income==.
replace income = 9 if income_wjp=="More than MGA 470,000" & ccode=="MDG" & income==.
replace income = -99 if income_wjp=="(DON'T READ) Does not know/ No answer" & ccode=="MDG" & income==.

replace income = 1 if income_wjp=="0 hasta 4735" & ccode=="MEX" & income==.
replace income = 3 if income_wjp=="4736 hasta 7852" & ccode=="MEX" & income==.
replace income = 5 if income_wjp=="7853 hasta 11612" & ccode=="MEX" & income==.
replace income = 7 if income_wjp=="11613 hasta 17794" & ccode=="MEX" & income==.
replace income = 9 if income_wjp=="17795 o m:s" & ccode=="MEX" & income==.
replace income = -99 if income_wjp=="" & ccode=="MEX" & income==.

replace income = 1 if income_wjp=="0 _15.000 DEN" & ccode=="MKD" & income==.
replace income = 3 if income_wjp=="15.001 _ 30.000 DEN" & ccode=="MKD" & income==.
replace income = 5 if income_wjp=="30.001 _ 45.000 DEN" & ccode=="MKD" & income==.
replace income = 7 if income_wjp=="45.001 _ 60.000 DEN" & ccode=="MKD" & income==.
replace income = 9 if income_wjp=="More than 60.000 DEN" & ccode=="MKD" & income==.
replace income = -99 if income_wjp=="Don`t know/No answer" & ccode=="MKD" & income==.

replace income = 1 if income_wjp=="XOF0 - XOF 150,000	" & ccode=="MLI" & income==.
replace income = 3 if income_wjp=="XOF 151,000 - XOF300,000" & ccode=="MLI" & income==.
replace income = 5 if income_wjp=="XOF301,000 - XOF450,000" & ccode=="MLI" & income==.
replace income = 7 if income_wjp=="XOF451,000 - XOF600,000" & ccode=="MLI" & income==.
replace income = 9 if income_wjp=="XOF 601,000 et ci-dessus" & ccode=="MLI" & income==.
replace income = -99 if income_wjp=="" & ccode=="MLI" & income==.

replace income = 1 if income_wjp=="1st quintile range" & ccode=="MLT" & income==.
replace income = 3 if income_wjp=="2nd quintile range" & ccode=="MLT" & income==.
replace income = 5 if income_wjp=="3rd quintile range" & ccode=="MLT" & income==.
replace income = 7 if income_wjp=="4th quintile range" & ccode=="MLT" & income==.
replace income = 9 if income_wjp=="5th quintile range" & ccode=="MLT" & income==.
replace income = -99 if income_wjp=="Don't know / No answer" & ccode=="MLT" & income==.

replace income = 1 if income_wjp=="50,001 – 200,000" & ccode=="MMR" & income==.
replace income = 3 if income_wjp=="200,001 – 300,000" & ccode=="MMR" & income==.
replace income = 5 if income_wjp=="300,001 – 400,000" & ccode=="MMR" & income==.
replace income = 7 if income_wjp=="400,001 – 600,000" & ccode=="MMR" & income==.
replace income = 9 if income_wjp=="Above 600,000" & ccode=="MMR" & income==.
replace income = -99 if income_wjp=="" & ccode=="MMR" & income==.

replace income = 1 if income_wjp=="Less than 300 001" & ccode=="MNG" & income==.
replace income = 3 if income_wjp=="300 001-500 000" & ccode=="MNG" & income==.
replace income = 5 if income_wjp=="500 001-900 000" & ccode=="MNG" & income==.
replace income = 7 if income_wjp=="900 001-1 600 000" & ccode=="MNG" & income==.
replace income = 9 if income_wjp=="Over 1 600 000" & ccode=="MNG" & income==.
replace income = -99 if income_wjp=="Don't know/No answer" & ccode=="MNG" & income==.

replace income = 1 if income_wjp=="Menos de 5000 MZN" & ccode=="MOZ" & income==.
replace income = 3 if income_wjp=="5000 MZN : 25000 MZN" & ccode=="MOZ" & income==.
replace income = 5 if income_wjp=="25001 MZN : 100000 MZN" & ccode=="MOZ" & income==.
replace income = 7 if income_wjp=="100001 MZN : 500000 MZN" & ccode=="MOZ" & income==.
replace income = -99 if income_wjp=="(N:O LEIA) N:o sabe/n:o respondeu" & ccode=="MOZ" & income==.

replace income = 1 if income_wjp=="Less than 125 000 MRO" & ccode=="MRT" & income==.
replace income = 3 if income_wjp=="125 000 to 250 000 MRO" & ccode=="MRT" & income==.
replace income = 5 if income_wjp=="250 000 to 375 000 MRO" & ccode=="MRT" & income==.
replace income = 7 if income_wjp=="375 000 to 500 000 MRO" & ccode=="MRT" & income==.
replace income = 9 if income_wjp=="More than 500 000 MRO" & ccode=="MRT" & income==.
replace income = -99 if (income_wjp=="Don't Know/No answer" | income_wjp=="Don’t know/No answer") & ccode=="MRT" & income==.

replace income = 1 if income_wjp=="Under Rs 16000" & ccode=="MUS" & income==.
replace income = 3 if income_wjp=="Rs 16,000 - 24,999" & ccode=="MUS" & income==.
replace income = 5 if income_wjp=="Rs 25,000 - 34,999" & ccode=="MUS" & income==.
replace income = 7 if income_wjp=="Rs 35,000 - 54,999" & ccode=="MUS" & income==.
replace income = 9 if income_wjp=="Rs 55,000 and above" & ccode=="MUS" & income==.
replace income = -99 if income_wjp=="Don’t know/No answer" & ccode=="MUS" & income==.

replace income = 1 if income_wjp=="Less than 36000" & ccode=="MWI" & income==.
replace income = 3 if income_wjp=="36001-50000" & ccode=="MWI" & income==.
replace income = 5 if income_wjp=="50001-100000" & ccode=="MWI" & income==.
replace income = 7 if income_wjp=="100001-180000" & ccode=="MWI" & income==.
replace income = 9 if income_wjp=="More than 180000" & ccode=="MWI" & income==.
replace income = -99 if income_wjp=="." & ccode=="MWI" & income==.

replace income = 1 if income_wjp=="RM2,999 or below" & ccode=="MYS" & income==.
replace income = 3 if income_wjp=="RM3,000-3,999" & ccode=="MYS" & income==.
replace income = 5 if income_wjp=="RM4,000-5,999" & ccode=="MYS" & income==.
replace income = 7 if income_wjp=="RM6,000-9,999" & ccode=="MYS" & income==.
replace income = 9 if income_wjp=="Above RM10,000" & ccode=="MYS" & income==.
replace income = -99 if income_wjp=="" & ccode=="MYS" & income==.

replace income = 1 if income_wjp=="N$ 0 - N$ 50,000" & ccode=="NAM" & income==.
replace income = 3 if income_wjp=="N$ 50,001 - N$ 100,000" & ccode=="NAM" & income==.
replace income = 5 if income_wjp=="N$ 100,001 - N$ 300,000" & ccode=="NAM" & income==.
replace income = 7 if income_wjp=="N$ 300,001 - N$ 500,000" & ccode=="NAM" & income==.
replace income = 9 if income_wjp=="N$ 500,001  and above" & ccode=="NAM" & income==.
replace income = -99 if income_wjp=="(DON:T READ) Don:t know/No answer" & ccode=="NAM" & income==.

replace income = 1 if income_wjp=="Less than 200 000 FCFA" & ccode=="NER" & income==.
replace income = 3 if income_wjp=="200 000 to 400 000 FCFA" & ccode=="NER" & income==.
replace income = 5 if income_wjp=="400 000 to 600 000 FCFA" & ccode=="NER" & income==.
replace income = 7 if income_wjp=="600 000 to 800 000 FCFA" & ccode=="NER" & income==.
replace income = 9 if income_wjp=="More than 800 000 FCFA" & ccode=="NER" & income==.
replace income = -99 if income_wjp=="Don't Know/No answer" & ccode=="NER" & income==.

replace income = 1 if income_wjp=="5,000 or less" & ccode=="NGA" & income==.
replace income = 3 if income_wjp=="5,001-20,000" & ccode=="NGA" & income==.
replace income = 5 if income_wjp=="20,001-35,999" & ccode=="NGA" & income==.
replace income = 7 if income_wjp=="36,000-70,000" & ccode=="NGA" & income==.
replace income = 9 if income_wjp=="More than 70,000" & ccode=="NGA" & income==.
replace income = -99 if income_wjp=="" & ccode=="NGA" & income==.

replace income = 1 if income_wjp=="Less than C$960" & ccode=="NIC" & income==.
replace income = 3 if income_wjp=="C$961 a C$1600" & ccode=="NIC" & income==.
replace income = 5 if income_wjp=="C$1601 a C$2400" & ccode=="NIC" & income==.
replace income = 7 if income_wjp=="C$2401 a C$3641" & ccode=="NIC" & income==.
replace income = 9 if income_wjp=="C$3641 and more" & ccode=="NIC" & income==.
replace income = -99 if income_wjp=="" & ccode=="NIC" & income==.

replace income = 1 if (income_wjp=="Less than €6,000" | income_wjp=="€6,000 - €11,999" | income_wjp=="€12,000 - €17,999" | income_wjp=="€18,000 - €23,999") & ccode=="NLD" & income==.
replace income = 3 if (income_wjp=="€24,000 - €29,999" | income_wjp=="€30,000 - €35,999" | income_wjp=="€36,000 - €41,999") & ccode=="NLD" & income==.
replace income = 5 if (income_wjp=="€42,000 - €47,999" | income_wjp=="€48,000 - €53,999" | income_wjp=="€54,000 - €59,999") & ccode=="NLD" & income==.
replace income = 7 if (income_wjp=="€60,000 - €69,999" | income_wjp=="€70,000 - €89,999") & ccode=="NLD" & income==.
replace income = 9 if (income_wjp=="€90,000 - €109,999" | income_wjp=="€110,000 or more") & ccode=="NLD" & income==.
replace income = -99 if income_wjp=="" & ccode=="NLD" & income==.

replace income = 1 if (income_wjp=="Less than 150.000 NOK" | income_wjp=="150.000 til 249.999 NOK" | income_wjp=="250.000 til 349.999 NOK") & ccode=="NOR" & income==.
replace income = 3 if income_wjp=="350.000 til 449.999 NOK" & ccode=="NOR" & income==.
replace income = 5 if income_wjp=="450.000 til 549.999 NOK" & ccode=="NOR" & income==.
replace income = 7 if income_wjp=="550.000 til 749.999 NOK" & ccode=="NOR" & income==.
replace income = 9 if (income_wjp=="750.000 til 999.999 NOK" | income_wjp=="1.000.000 NOK or more") & ccode=="NOR" & income==.
replace income = -99 if income_wjp=="" & ccode=="NOR" & income==.

replace income = 1 if income_wjp=="Less than NPR. 10,000  per month" & ccode=="NPL" & income==.
replace income = 3 if income_wjp=="NPR. 10,001 : NPR. 20,000" & ccode=="NPL" & income==.
replace income = 5 if income_wjp=="NPR. 20,001 : NPR. 40,000" & ccode=="NPL" & income==.
replace income = 7 if income_wjp=="NPR. 40,001 : NPR. 75,000" & ccode=="NPL" & income==.
replace income = 9 if income_wjp=="More than NPR. 75,000 per month" & ccode=="NPL" & income==.
replace income = -99 if income_wjp=="" & ccode=="NPL" & income==.

replace income = 1 if income_wjp=="Under $35,000" & ccode=="NZL" & income==.
replace income = 3 if income_wjp=="$35,001 - $60,000" & ccode=="NZL" & income==.
replace income = 5 if income_wjp=="$60,001 - $90,000" & ccode=="NZL" & income==.
replace income = 7 if income_wjp=="$90,001 - $135,000" & ccode=="NZL" & income==.
replace income = 9 if income_wjp=="$135,001 and above" & ccode=="NZL" & income==.
replace income = -99 if income_wjp=="" & ccode=="NZL" & income==.

replace income = 1 if income_wjp=="1st quintile range" & ccode=="PAK" & income==.
replace income = 3 if income_wjp=="2nd quintile range" & ccode=="PAK" & income==.
replace income = 5 if income_wjp=="3rd quintile range" & ccode=="PAK" & income==.
replace income = 7 if income_wjp=="4th quintile range" & ccode=="PAK" & income==.
replace income = 9 if income_wjp=="5th quintile range" & ccode=="PAK" & income==.
replace income = -99 if income_wjp=="Don't know/No answer" & ccode=="PAK" & income==.

replace income = 1 if income_wjp=="Menos de B 399	" & ccode=="PAN" & income==.
replace income = 3 if income_wjp=="B400 a B599" & ccode=="PAN" & income==.
replace income = 5 if income_wjp=="B600 A 799" & ccode=="PAN" & income==.
replace income = 7 if income_wjp=="B800 A 1499" & ccode=="PAN" & income==.
replace income = 9 if income_wjp=="B1500 o más" & ccode=="PAN" & income==.
replace income = -99 if income_wjp=="" & ccode=="PAN" & income==.

replace income = 1 if income_wjp=="1st quintile range" & ccode=="PER" & income==.
replace income = 3 if income_wjp=="2nd quintile range" & ccode=="PER" & income==.
replace income = 5 if income_wjp=="3rd quintile range" & ccode=="PER" & income==.
replace income = 7 if income_wjp=="4th quintile range" & ccode=="PER" & income==.
replace income = 9 if income_wjp=="5th quintile range" & ccode=="PER" & income==.
replace income = -99 if (income_wjp=="(DON T READ) Don t know/No answer" | income_wjp=="") & ccode=="PER" & income==.

replace income = 1 if income_wjp=="___20,000 or less" & ccode=="PHL" & income==.
replace income = 3 if income_wjp=="___20,000 : ___30,000" & ccode=="PHL" & income==.
replace income = 5 if income_wjp=="___30,000 : ___40,000" & ccode=="PHL" & income==.
replace income = 7 if income_wjp=="___40,000 : ___60,000" & ccode=="PHL" & income==.
replace income = 9 if income_wjp=="___60,000 or more" & ccode=="PHL" & income==.
replace income = -99 if (income_wjp=="DNA" | income_wjp=="DNK" | income_wjp=="Prefer not to answer") & ccode=="PHL" & income==.

replace income = 1 if (income_wjp=="501 : 1 000 z:" | income_wjp=="1 001 : 1 500 z:" | income_wjp=="1 501 : 2 000 z:") & ccode=="POL" & income==.
replace income = 3 if (income_wjp=="2 001 : 3 000 z:" | income_wjp=="3 001 : 4 000 z:") & ccode=="POL" & income==.
replace income = 5 if (income_wjp=="4 001 : 5 000 z:" | income_wjp=="5 001 : 6 000 z:") & ccode=="POL" & income==.
replace income = 7 if (income_wjp=="6 001 : 7 000 z:" | income_wjp=="7 001 : 8 000 z:") & ccode=="POL" & income==.
replace income = 9 if (income_wjp=="8 001 : 9 000 z:" | income_wjp=="9 001 : 10 000 z:" | income_wjp=="more than 10000 z:") & ccode=="POL" & income==.
replace income = -99 if (income_wjp=="Don:t know/No answer" | income_wjp=="None") & ccode=="POL" & income==.

replace income = 1 if (income_wjp=="Less than EUR 5.000" | income_wjp=="EUR 5.000 - 9.999" | income_wjp=="EUR 10.000 - 14.999" | income_wjp=="EUR 15.000 - 19.999") & ccode=="PRT" & income==.
replace income = 3 if (income_wjp=="EUR 20.000 - 24.999" | income_wjp=="EUR 25.000 - 29.999" | income_wjp=="EUR 30.000 - 34.999") & ccode=="PRT" & income==.
replace income = 5 if (income_wjp=="EUR 35.000 - 39.999" | income_wjp=="EUR 40.000 - 44.999" | income_wjp=="EUR 45.000 - 49.999") & ccode=="PRT" & income==.
replace income = 7 if (income_wjp=="EUR 50.000 - 59.999" | income_wjp=="EUR 60.000 - 69.999" | income_wjp=="EUR 70.000 - 79.999") & ccode=="PRT" & income==.
replace income = 9 if (income_wjp=="EUR 80.000 - 89.999" | income_wjp=="EUR 90.000 - 99.999" | income_wjp=="EUR 100.000 or more") & ccode=="PRT" & income==.
replace income = -99 if income_wjp=="" & ccode=="PRT" & income==.

replace income = 1 if income_wjp=="Less than 1,914" & ccode=="PRY" & income==.
replace income = 3 if income_wjp=="Between 1,914 to 3,124" & ccode=="PRY" & income==.
replace income = 5 if income_wjp=="Between 3,125 to 4,514" & ccode=="PRY" & income==.
replace income = 7 if income_wjp=="Between 4,515 to 7,733" & ccode=="PRY" & income==.
replace income = 9 if income_wjp=="More than 7,773" & ccode=="PRY" & income==.
replace income = -99 if income_wjp=="" & ccode=="PRY" & income==.

replace income = 1 if income_wjp=="under 1700 RON" & ccode=="ROU" & income==.
replace income = 3 if income_wjp=="1701-2300 RON" & ccode=="ROU" & income==.
replace income = 5 if income_wjp=="2301-3000 RON" & ccode=="ROU" & income==.
replace income = 7 if income_wjp=="3001-4300 RON" & ccode=="ROU" & income==.
replace income = 9 if income_wjp=="over 4300 RON" & ccode=="ROU" & income==.
replace income = -99 if income_wjp=="" & ccode=="ROU" & income==.

replace income = 1 if income_wjp=="45,000 or less" & ccode=="RWA" & income==.
replace income = 3 if income_wjp=="45,001-60,000" & ccode=="RWA" & income==.
replace income = 5 if income_wjp=="60,001-130,000" & ccode=="RWA" & income==.
replace income = 7 if income_wjp=="130,001-200,000" & ccode=="RWA" & income==.
replace income = 9 if income_wjp=="More than 200,000" & ccode=="RWA" & income==.
replace income = -99 if income_wjp=="" & ccode=="RWA"

replace income = -99 if income_wjp=="" & ccode=="SDN" & income==. //data too choppy for SDN to be reliable

replace income = 1 if (income_wjp=="30,001 - 100,000 F CFA" | income_wjp=="Moins de 200 000 FCFA") & ccode=="SEN" & income==.
replace income = 3 if income_wjp=="200 000 : 400 000 FCFA" & ccode=="SEN" & income==.
replace income = 5 if income_wjp=="400 000 : 600 000 FCFA" & ccode=="SEN" & income==.
replace income = 7 if income_wjp=="600 000 : 800 000 FCFA" & ccode=="SEN" & income==.
replace income = 9 if income_wjp=="Plus de 800.000 FCFA" & ccode=="SEN" & income==.
replace income = -99 if income_wjp=="Don:t know/No answer" & ccode=="SEN" & income==.

replace income = 1 if income_wjp=="Less than $24,000" & ccode=="SGP" & income==.
replace income = 3 if income_wjp=="$24,000 - $71,999" & ccode=="SGP" & income==.
replace income = 5 if income_wjp=="$72,000 - $119,999" & ccode=="SGP" & income==.
replace income = 7 if income_wjp=="$120,000 - $179,999" & ccode=="SGP" & income==.
replace income = 9 if income_wjp=="$180,000+" & ccode=="SGP" & income==.
replace income = -99 if income_wjp=="Don:t know/No answer" & ccode=="SGP" & income==.

replace income = 1 if income_wjp=="250 or less" & ccode=="SLE" & income==.
replace income = 3 if income_wjp=="251-60,000" & ccode=="SLE" & income==.
replace income = 5 if income_wjp=="60,001-250,000" & ccode=="SLE" & income==.
replace income = 7 if income_wjp=="250,001-580,000" & ccode=="SLE" & income==.
replace income = 9 if income_wjp=="More than 580,000" & ccode=="SLE" & income==.
replace income = -99 if income_wjp=="" & ccode=="SLE" & income==.

replace income = 1 if income_wjp=="$250 - $400" & ccode=="SLV" & income==.
replace income = 3 if income_wjp=="$500 - $700" & ccode=="SLV" & income==.
replace income = 5 if income_wjp=="$800 - $1200" & ccode=="SLV" & income==.
replace income = 7 if income_wjp=="$1300 - $4100" & ccode=="SLV" & income==.
replace income = 9 if income_wjp=="$4200 +" & ccode=="SLV" & income==.
replace income = -99 if income_wjp=="" & ccode=="SLV" & income==.

replace income = 1 if income_wjp=="Up to 22320 RSD" & ccode=="SRB" & income==.
replace income = 3 if income_wjp=="22320 to 39680 RSD" & ccode=="SRB" & income==.
replace income = 5 if income_wjp=="39681 to 55800 RSD" & ccode=="SRB" & income==.
replace income = 7 if income_wjp=="55801 to 76880 RSD" & ccode=="SRB" & income==.
replace income = 9 if income_wjp=="More than 76881  RSD" & ccode=="SRB" & income==.
replace income = -99 if income_wjp=="Don't know/No answer" & ccode=="SRB" & income==.

replace income = 1 if income_wjp=="1st quintile range" & ccode=="SUR" & income==.
replace income = 3 if income_wjp=="2nd quintile range" & ccode=="SUR" & income==.
replace income = 5 if income_wjp=="3rd quintile range" & ccode=="SUR" & income==.
replace income = 7 if income_wjp=="4th quintile range" & ccode=="SUR" & income==.
replace income = 9 if income_wjp=="5th quintile range" & ccode=="SUR" & income==.
replace income = -99 if income_wjp=="Don't Know/No answer" & ccode=="SUR" & income==.

replace income = 1 if income_wjp=="0 – 800 €" & ccode=="SVK" & income==.
replace income = 3 if income_wjp=="801 – 1,100 €" & ccode=="SVK" & income==.
replace income = 5 if income_wjp=="1,101 – 1,440€" & ccode=="SVK" & income==.
replace income = 7 if income_wjp=="1,441 – 1,874 €" & ccode=="SVK" & income==.
replace income = 9 if income_wjp=="More than 1,874€" & ccode=="SVK" & income==.
replace income = -99 if income_wjp=="" & ccode=="SVK" & income==.

replace income = 1 if income_wjp=="Up to 1.147 EUR" & ccode=="SVN" & income==.
replace income = 3 if income_wjp=="1.147- 1.492 EUR" & ccode=="SVN" & income==.
replace income = 5 if income_wjp=="1.493 - 1.821 EUR" & ccode=="SVN" & income==.
replace income = 7 if income_wjp=="1.822 - 2.340 EUR" & ccode=="SVN" & income==.
replace income = 9 if income_wjp=="More than 2.340 EUR" & ccode=="SVN" & income==.
replace income = -99 if income_wjp=="*" & ccode=="SVN" & income==.

replace income = 1 if (income_wjp=="Less than 100 000 SEK" | income_wjp=="100 000 till 199 999 SEK" | income_wjp=="200 000 till 299 999 SEK") & ccode=="SWE" & income==.
replace income = 3 if (income_wjp=="300 000 till 399 999 SEK" | income_wjp=="400 000 till 499 999 SEK") & ccode=="SWE" & income==.
replace income = 5 if (income_wjp=="500 000 till 599 999 SEK" | income_wjp=="600 000 till 699 999 SEK") & ccode=="SWE" & income==.
replace income = 7 if (income_wjp=="700 000 till 799 999 SEK" | income_wjp=="800 000 till 899 999 SEK") & ccode=="SWE" & income==.
replace income = 9 if (income_wjp=="900 000 till 999 999 SEK" | income_wjp=="1 000 000 SEK or more") & ccode=="SWE" & income==.
replace income = -99 if income_wjp=="" & ccode=="SWE" & income==.

replace income = 1 if income_wjp=="XOF0 - XOF 150,000" & ccode=="TGO" & income==.
replace income = 3 if income_wjp=="XOF 151,000 - XOF300,000" & ccode=="TGO" & income==.
replace income = 5 if income_wjp=="XOF301,000 - XOF450,000" & ccode=="TGO" & income==.
replace income = 7 if income_wjp=="XOF451,000 - XOF600,000" & ccode=="TGO" & income==.
replace income = 9 if income_wjp=="XOF 601,000 and above" & ccode=="TGO" & income==.
replace income = -99 if income_wjp=="" & ccode=="TGO" & income==.

replace income = 1 if income_wjp=="A" & ccode=="THA" & income==.
replace income = 3 if income_wjp=="B" & ccode=="THA" & income==.
replace income = 5 if income_wjp=="C" & ccode=="THA" & income==.
replace income = 7 if income_wjp=="D" & ccode=="THA" & income==.
replace income = 9 if income_wjp=="E" & ccode=="THA" & income==.
replace income = -99 if income_wjp=="" & ccode=="THA" & income==.

replace income = 1 if income_wjp=="Less than TT$1700" & ccode=="TTO" & income==.
replace income = 3 if income_wjp=="TT$1700 to TT$3499" & ccode=="TTO" & income==.
replace income = 5 if income_wjp=="TT$3500 to TT$5799" & ccode=="TTO" & income==.
replace income = 7 if income_wjp=="TT$5800 to TT$8699" & ccode=="TTO" & income==.
replace income = 9 if income_wjp=="TT$8700 and more" & ccode=="TTO" & income==.
replace income = -99 if income_wjp=="" & ccode=="TTO" & income==.

replace income = 1 if income_wjp=="Less than 600" & ccode=="TUN" & income==.
replace income = 3 if income_wjp=="Between 601 - 1000" & ccode=="TUN" & income==.
replace income = 5 if income_wjp=="Between 1001 - 1500" & ccode=="TUN" & income==.
replace income = 7 if income_wjp=="Between 1501 - 2500" & ccode=="TUN" & income==.
replace income = 9 if income_wjp=="More than 2500" & ccode=="TUN" & income==.
replace income = -99 if income_wjp=="Don't know/No answer" & ccode=="TUN" & income==.

replace income = 1 if (income_wjp=="Little than 1300 TL" | income_wjp=="Between 1301-1500 TL") & ccode=="TUR" & income==.
replace income = 3 if (income_wjp=="Between 1.501-2.500 TL" | income_wjp=="Between 2.501-3.500 TL") & ccode=="TUR" & income==.
replace income = 5 if (income_wjp=="Between 3.501-5.000 TL" | income_wjp=="Between 5.001-7.000 TL") & ccode=="TUR" & income==.
replace income = 7 if (income_wjp=="Between 7.001-9.000 TL" | income_wjp=="Between 9.001-11.000 TL") & ccode=="TUR" & income==.
replace income = 9 if (income_wjp=="Between 11.001-13.000 TL" | income_wjp=="More than 13.001 TL") & ccode=="TUR" & income==.
replace income = -99 if income_wjp=="" & ccode=="TUR" & income==.

replace income = 1 if income_wjp=="100,000 or less" & ccode=="TZA" & income==.
replace income = 3 if income_wjp=="100,001-200,000" & ccode=="TZA" & income==.
replace income = 5 if income_wjp=="200,001-300,000" & ccode=="TZA" & income==.
replace income = 7 if income_wjp=="300,001-500,000" & ccode=="TZA" & income==.
replace income = 9 if income_wjp=="More than 500,000" & ccode=="TZA" & income==.
replace income = -99 if income_wjp=="" & ccode=="TZA" & income==.

replace income = 1 if income_wjp=="Up to 301,000" & ccode=="UGA" & income==.
replace income = 3 if income_wjp=="301,001-904,000" & ccode=="UGA" & income==.
replace income = 5 if income_wjp=="904,001-2,412,000" & ccode=="UGA" & income==.
replace income = 7 if income_wjp=="2,412,001-4,522,000" & ccode=="UGA" & income==.
replace income = 9 if income_wjp=="More than 4,522,000" & ccode=="UGA" & income==.
replace income = -99 if income_wjp=="Don't know/no answer" & ccode=="UGA" & income==.

replace income = 1 if income_wjp=="Less than 4100 UAH" & ccode=="UKR" & income==.
replace income = 3 if income_wjp=="4101  : 6400 UAH" & ccode=="UKR" & income==.
replace income = 5 if income_wjp=="6401 : 8700 UAH" & ccode=="UKR" & income==.
replace income = 7 if income_wjp=="8701 : 11300 UAH" & ccode=="UKR" & income==.
replace income = 9 if income_wjp=="More than 11301 UAH" & ccode=="UKR" & income==.
replace income = -99 if income_wjp=="Don:t know\No answer" & ccode=="UKR" & income==.

replace income = 1 if income_wjp=="A" & ccode=="URY" & income==.
replace income = 3 if income_wjp=="B" & ccode=="URY" & income==.
replace income = 5 if income_wjp=="C" & ccode=="URY" & income==.
replace income = 7 if income_wjp=="D" & ccode=="URY" & income==.
replace income = 9 if income_wjp=="E" & ccode=="URY" & income==.
replace income = -99 if income_wjp=="" & ccode=="URY" & income==.

replace income = 1 if income_wjp=="Less than 25,600" & ccode=="USA" & income==.
replace income = 3 if income_wjp=="25,600 - 50,000" & ccode=="USA" & income==.
replace income = 5 if income_wjp=="50,001 - 79,542" & ccode=="USA" & income==.
replace income = 7 if income_wjp=="79,543 - 130,000" & ccode=="USA" & income==.
replace income = 9 if income_wjp=="130,001 or more" & ccode=="USA" & income==.
replace income = -99 if income_wjp=="" & ccode=="USA" & income==.

replace income = 1 if income_wjp=="0-350" & ccode=="XKX" & income==.
replace income = 3 if income_wjp=="351-450" & ccode=="XKX" & income==.
replace income = 5 if income_wjp=="451-600" & ccode=="XKX" & income==.
replace income = 7 if income_wjp=="601-800" & ccode=="XKX" & income==.
replace income = 9 if income_wjp=="over 800" & ccode=="XKX" & income==.
replace income = -99 if income_wjp==""

replace income = 1 if income_wjp=="Up to R 1399" & ccode=="ZAF" & income==.
replace income = 3 if income_wjp=="R 1 400 -  R 2499" & ccode=="ZAF" & income==.
replace income = 5 if income_wjp=="R 5 000 - R 11 999" & ccode=="ZAF" & income==.
replace income = 7 if income_wjp=="R 11 000 - R 19 999" & ccode=="ZAF" & income==.
replace income = 9 if income_wjp=="R 20 000 +" & ccode=="ZAF" & income==.
replace income = -99 if income_wjp=="(DON:T READ) Don:t know/No answer" & ccode=="ZAF" & income==.

replace income = 1 if income_wjp=="A" & ccode=="ZWE" & income==.
replace income = 3 if income_wjp=="B" & ccode=="ZWE" & income==.
replace income = 5 if income_wjp=="C" & ccode=="ZWE" & income==.
replace income = 7 if income_wjp=="D" & ccode=="ZWE" & income==.
replace income = 9 if income_wjp=="E" & ccode=="ZWE" & income==.
replace income = -99 if income_wjp=="" & ccode=="ZWE" & income==.

replace income = -99 if income==.

*ideology
*			1   left  
*			2         
*			3         
*			4         
*			5         
*			6         
*			7         
*			8         
*			9         
*			10  right
*		   -99  Missing

gen ideology = -99

*marital
*			1   Married
*			2   Not Married
*		  -99   Missing

rename marital marital_wjp
gen marital = 1 if marital_wjp==3|marital_wjp==2
replace marital = 2 if marital_wjp==1|marital_wjp==4|marital_wjp==5
replace marital = -99 if marital_wjp==99|marital_wjp==.

*urban
*			1   Urban
*			2   Rural
*		  -99   Missing

gen urban = 1 if Urban==1
replace urban = 2 if Urban==2
replace urban = -99 if Urban==.|Urban>2

*born_country
*			1   Born in country
*			0   Not born in country

gen born_country = .

keep S009 ccode country numcode country_short cow wave trust_state trust_govt trust_justice trust_police trust_civil_service trust_local_govt trust_parties trust_parliament trust_others trust_military survey_year age yob cohort sex religion edu occupation employment_status income ideology marital urban survey born_country weight 

sort ccode wave survey_year

save "$data_dir/clean/wjp_clean.dta", replace

